#pragma once

#include "Common/Lang/LangUtils.h"
#include <assert.h>

#include "../resource.h"

namespace FileManager
{

	class CWindows
	{
	public:
		CWindows();
		~CWindows();
		
		static CString HResultToMessage(HRESULT errorCode);

		//All message box functions copied from CPanel
		static void MessageBoxInfo(HWND hWnd, LPCWSTR message, LPCWSTR caption)
		{
			assert(nullptr != hWnd);
			::MessageBoxW(hWnd, message, caption, MB_OK);
		}
		static void MessageBox(HWND hWnd, LPCWSTR message, LPCWSTR caption)
		{
			assert(nullptr != hWnd);
			::MessageBoxW(hWnd, message, caption, MB_OK | MB_ICONSTOP);
		}
		static void MessageBox(HWND hWnd, LPCWSTR message)
		{
			MessageBox(hWnd, message, _T("7-Zip"));
		}
		static void MessageBoxMyError(HWND hWnd, LPCWSTR message)
		{
			MessageBox(hWnd, message, _T("Error"));
		}


		static void MessageBoxError(HWND hWnd, HRESULT errorCode, LPCWSTR caption)
		{
			MessageBox(hWnd, HResultToMessage(errorCode), caption);
		}

		static void MessageBoxError(HWND hWnd, HRESULT errorCode)
		{
			MessageBoxError(hWnd, errorCode, _T("7-Zip"));
		}
		static void MessageBoxLastError(HWND hWnd, LPCWSTR caption)
		{
			MessageBoxError(hWnd, ::GetLastError(), caption);
		}
		static void MessageBoxLastError(HWND hWnd)
		{
			MessageBoxLastError(hWnd, _T("Error"));
		}

		static void MessageBoxErrorLang(HWND hWnd, UINT resourceID, UINT32 langID)
		{
			MessageBox(hWnd, Common::Lang::LangString(resourceID, langID));
		}

		//Taken from DirectoryOperations.cpp/PanelOperations.cpp
		static void MessageBoxErrorForUpdate(HWND hWnd, HRESULT errorCode, UINT resourceID, UINT32 langID)
		{
			if (errorCode == E_NOINTERFACE)
			{
				MessageBoxErrorLang(hWnd, IDS_OPERATION_IS_NOT_SUPPORTED, 0x03020208);
			}
			else
			{
				MessageBoxError(hWnd, errorCode, Common::Lang::LangString(resourceID, langID));
			}
		}


	private:

	};

	

}//namespace FileManager
